#!/bin/sh /etc/rc.common
# Copyright (C) 2017 OpenWrt.org

START=92
USE_PROCD=1
PROG=/usr/bin/baresip

start_service()
{
	local enable options

	uci_validate_section baresip baresip main \
		'enable:bool:0' \
		'options:string'

	[ "$enable" = "0" ] && return

	procd_open_instance
	procd_set_param command $PROG -f /etc/baresip $options
	procd_set_param user baresip
	procd_set_param respawn
	procd_close_instance
}

service_triggers()
{
	procd_add_reload_trigger baresip
}
